package com.sskj.miner.presenter;

import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.common.base.HttpData;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonConverter;
import com.sskj.miner.bean.ForceBean;
import com.sskj.miner.ui.activity.ForceListActivity;

import java.util.ArrayList;
import java.util.List;

import io.reactivex.Flowable;


public class ForceListActivityPresenter extends BasePresenter<ForceListActivity> {

    public Flowable<List<ForceBean>> getData(String p,String size){
        return httpService.getForceList(p, size)
                .converter(new JsonConverter<HttpData<PageBean<ForceBean>>>() {
                })
                .adapt(new FlowableBody<>())
                .map(pageBeanHttpData -> pageBeanHttpData.getData().getList())
                .onErrorReturnItem(new ArrayList<>());
    }
}
